import request from './http.request';

//账号密码登陆
export function login(data) {
  return request({
    url: '/admin/user/login',
    method: 'post',
    data:data
  });
}

//微信登录
export function loginByWechat(code) {
  return request({
    url: `/admin/social/login/WX@${code}`,
    method: 'get',
  });
}

//微信绑定
export function bindWechat(code) {
  return request({
    url: `/admin/social/bindzz?state=WX&code=${code}`,
    method: 'post',
  });
}

//免登陆获取用户信息
export function getUserInfo(username) {
  return request({
    url: `/admin/user/info/${username}`,
    method: 'get',
  });
}

//获取租户id
export function getTenantId(username) {
  return request({
    url: `/admin/user/tenant/${username}`,
    method: 'get'
  });
}

//获取项目列表
export function getProjects() {
  return request({
    url: '/admin/user/getProjectDept',
    method: 'post',
  });
}

//获取权限列表
export function getAuthList() {
  return request({
    url: '/admin/user/permissions-menus',
    method: 'get',
  });
}

//获取用户所属项目
export function getUserDept() {
  return request({
    url: '/pm/task/user/deptId/v2',
    method: 'get',
  });
}

//修改密码
export function changePass(data) {
  return request({
    url: '/admin/user/edit_pwd',
    method: 'put',
    data:data
  });
}

//退出
export function logout() {
  return request({
    url: `${process.env.VUE_APP_ZDB_URL}/eep/sys/logout`,
    method: 'post',
  });
}